package com.lesso.lzh.sunflower.app.service.impl;

import com.baomidou.mybatisplus.plugins.Page;
import com.lesso.lzh.sunflower.domain.service.EmployeeAttendanceRuleDomainService;
import com.lesso.lzh.sunflower.infra.assembler.EmployeeAttendanceRuleAssembler;
import com.lesso.lzh.sunflower.model.EmployeeAttendanceRule;
import com.lesso.lzh.sunflower.pojo.dto.EmployeeAttendanceRuleDTO;
import com.lesso.lzh.sunflower.pojo.dto.EmployeeAttendanceRuleQueryDTO;
import com.lesso.lzh.sunflower.pojo.vo.EmployeeAttendanceRuleVO;
import com.lesso.lzh.sunflower.service.IEmployeeAttendanceRuleService;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.stereotype.Service;

/**
 * EmployeeAttendanceRuleServiceImpl
 *
 * @author zqz
 * @since 2025-07-04
 */
@Service
@DubboService
public class EmployeeAttendanceRuleServiceImpl implements IEmployeeAttendanceRuleService {
    private final EmployeeAttendanceRuleDomainService employeeAttendanceRuleDomainService;

    public EmployeeAttendanceRuleServiceImpl(EmployeeAttendanceRuleDomainService employeeAttendanceRuleDomainService) {
        this.employeeAttendanceRuleDomainService = employeeAttendanceRuleDomainService;
    }

    @Override
    public Long save(EmployeeAttendanceRuleDTO dto) {
        return employeeAttendanceRuleDomainService.save(dto);
    }

    @Override
    public Page<EmployeeAttendanceRuleVO> page(EmployeeAttendanceRuleQueryDTO dto) {
        return employeeAttendanceRuleDomainService.page(dto);
    }

    @Override
    public Page<EmployeeAttendanceRuleVO> customPage(EmployeeAttendanceRuleQueryDTO dto) {
        return employeeAttendanceRuleDomainService.customPage(dto);
    }

    @Override
    public void deleteById(Long id) {
        employeeAttendanceRuleDomainService.deleteById(id);
    }

    @Override
    public EmployeeAttendanceRule selectById(Long id) {
        return employeeAttendanceRuleDomainService.selectById(id);
    }

    @Override
    public void update(EmployeeAttendanceRuleDTO dto) {
        EmployeeAttendanceRule rule = EmployeeAttendanceRuleAssembler.INSTANCE.dtoToEntity(dto);
        employeeAttendanceRuleDomainService.update(rule);
    }
}